#pragma once
#include "EventLoop.h"
#include "Sock.h"
#include "Channel.h"
#include"Acceptor.h"
#include<unordered_map>
#include<iostream>
#include <memory>
class TcpServer
{
public:
    TcpServer(const uint16_t port);
    ~TcpServer();
    void newconnection(Sock *clientSock);    // 处理新客户端连接请求
    void start();
private:
    EventLoop loop_;
    Acceptor *acceptor_; 
    std::unordered_map<int,Connection*> conns_;
};